export default function download(filename, url, data) {
    fetch(url, {
        method: "POST",
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        body: JSON.stringify(data),
    }).then(res => {
        res.blob().then(content => {
            var elink = document.createElement('a');
            elink.download = filename;
            elink.style.display = 'none';
            var blob = new Blob([content]);
            elink.href = URL.createObjectURL(blob);
            document.body.appendChild(elink);
            elink.click();
            document.body.removeChild(elink);
        })
    });
}